package com.ruoyi.manage.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.manage.entity.order.OrderDistributeDto;
import com.ruoyi.manage.entity.order.OrderUnbindDto;
import com.ruoyi.manage.service.IOrderDistributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/manage/orderDistribute")
public class OrderDistributeController extends BaseController {

    @Autowired
    private IOrderDistributeService IOrderDistributeService;

    @PostMapping("/bindManagerWriter")
    public AjaxResult bindManagerWriter(@RequestBody OrderDistributeDto orderDistribute){
        IOrderDistributeService.createOrderDistribute(orderDistribute);
        return success("稿件分配成功");
    }

    /**
     * 解除绑定
     * @return
     */
    @PostMapping("/writerUnbind")
    public AjaxResult writerUnbind(@RequestBody OrderUnbindDto orderUnbind) {
        IOrderDistributeService.orderUnbind(orderUnbind);
        return success("解除绑定成功");
    }

}
